import $ from 'jquery'
let go={}
go.num = 1
go.uid = ()=>{
    // console.log(go.num)
    // return Date.now () + go.num++
    return go.num++
}

//复制一个对象
go.copy = (obj)=>{
    //方案1
    // return JSON.parse(JSON.stringify(obj))
    //方案2
    // return Object.create(obj)

    //方案3
    var newObj = {};
    if (obj instanceof Array) {
        newObj = [];
    }
    for (var key in obj) {
        var val = obj[key];
        newObj[key] = val;
    }
    return newObj;
}
//复制一个对象
go.addSscrollbar = (items, height)=>{
    if(!height){
        height = $('#root').height() - 65
    }

    //批量添加
    items.forEach(item => {
        let itemHeight = $(item).outerHeight()
        console.log('itemHeight', itemHeight)
        console.log('rootHeight', height)
        if(itemHeight > height){
            $(item).parent().addClass('scroll-y')
        }
    })

}
export default go


